package com.handl.springcloud;

import feign.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
//开启客户端服务注册功能
@EnableDiscoveryClient
//开启feign，包含了负载均衡和断路器
@EnableFeignClients
//开启断路器仪表盘功能
@EnableHystrixDashboard
//不开启，会导致feign断路器仪表盘报链接错误
@EnableCircuitBreaker
//开启支持集群服务仪表盘监控
@EnableTurbine
public class FeignApplication {

	/**
	 * 要开启Feign的日志功能，默认是Logger.Level.NONE，这样不会输出任何内容，
	 * 需要修改为Logger.Level.FULL
	 * @return
	 */
	@Bean
	Logger.Level feignLoggerLevel(){
		return Logger.Level.FULL;
	}


	public static void main(String[] args) {
		SpringApplication.run(FeignApplication.class, args);
	}
}
